home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Skunkware 5
/
Skunkware 5.iso
/
src
/
X11
/
xsw
/
diskspace.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-05-09
|
27KB
|
983 lines
/*
* @(#) diskspace.c 12.1 95/05/09
*/
/***************************************************************************
*
* Copyright (c) 1990-1993 The Santa Cruz Operation, Inc.
*
* All rights reserved. No part of this program or publication may be
* reproduced, transmitted, transcribed, stored in a retrieval system,
* or translated into any language or computer language, in any form or
* by any means, electronic, mechanical, magnetic, optical, chemical,
* biological, or otherwise, without the prior written permission of:
*
* The Santa Cruz Operation , Inc. (408) 425-7222
* 400 Encinal St., Santa Cruz, California 95060 USA
*
**************************************************************************/
/*
* Modification History
*
* S000, 30-Sep-92, rickra
* Initial check in.
*/
/*+-------------------------------------------------------------------------
diskspace.c - XSW disk space display handler
Defined functions:
draw_disk_space_literals(x,y)
update_disk_space()
--------------------------------------------------------------------------*/
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Intrinsic.h>
#include <X11/Shell.h>
#include <Xm/Xm.h>
#include <Xm/MainW.h>
#include <Xm/DrawingA.h>
#include "include/unixincs.h"
#include "include/buttons.h"
#include "include/xsw.h"
extern struct NetworkXswStruct *current_server;
int diskspace_tlx;
int diskspace_tly;
/*-------------------------------------------------------------------------
disk_space_total_compare(ppp1,ppp2)
--------------------------------------------------------------------------*/
disk_space_total_compare (ppp1, ppp2)
register disk_space *ppp1;
register disk_space *ppp2;
{
if (current_server ->
disk_space_sort_order == 1)
return (ppp2 -> f_blocks - ppp1 -> f_blocks);
else
return (ppp1 -> f_blocks - ppp2 -> f_blocks);
} /* end of disk_space_total_compare */
/*-------------------------------------------------------------------------
disk_space_free_compare(ppp1,ppp2)
--------------------------------------------------------------------------*/
disk_space_free_compare (ppp1, ppp2)
register disk_space *ppp1;
register disk_space *ppp2;
{
if (current_server ->
disk_space_sort_order == 1)
return (ppp2 -> f_bfree - ppp1 -> f_bfree);
else
return (ppp1 -> f_bfree - ppp2 -> f_bfree);
} /* end of disk_space_free_compare */
/*-------------------------------------------------------------------------
disk_space_used_compare(ppp1,ppp2)
--------------------------------------------------------------------------*/
disk_space_used_compare (ppp1, ppp2)
register disk_space *ppp1;
register disk_space *ppp2;
{
if (current_server ->
disk_space_sort_order == 1)
return ((ppp2 -> f_blocks - ppp2 -> f_bfree) -
(ppp1 -> f_blocks - ppp1 -> f_bfree));
else
return ((ppp1 -> f_blocks - ppp1 -> f_bfree) -
(ppp2 -> f_blocks - ppp2 -> f_bfree));
} /* end of disk_space_used_compare */
/*-------------------------------------------------------------------------
disk_space_percent_used_compare(ppp1,ppp2)
NOTE: The return value MUST be an integer.... Should revisit this...
--------------------------------------------------------------------------*/
disk_space_percent_used_compare (ppp1, ppp2)
register disk_space *ppp1;
register disk_space *ppp2;
{
if ((ppp2 -> f_blocks == 0) && (ppp1 -> f_blocks == 0))
return (0);
else if (ppp2 -> f_blocks == 0)
return (-1);
else if (ppp1 -> f_blocks == 0)
return (1);
if (current_server ->
disk_space_sort_order == 1)
return ((((ppp2 -> f_blocks - ppp2 -> f_bfree) * 100) / ppp2 -> f_blocks) -
(((ppp1 -> f_blocks - ppp1 -> f_bfree) * 100) / ppp1 -> f_blocks));
else
return ((((ppp1 -> f_blocks - ppp1 -> f_bfree) * 100) / ppp1 -> f_blocks) -
(((ppp2 -> f_blocks - ppp2 -> f_bfree) * 100) / ppp2 -> f_blocks));
} /* end of disk_space_percent_used_compare */
/*-------------------------------------------------------------------------
disk_space_percent_free_compare(ppp1,ppp2)
NOTE: The return value MUST be an integer.... Should revisit this...
--------------------------------------------------------------------------*/
disk_space_percent_free_compare (ppp1, ppp2)
register disk_space *ppp1;
register disk_space *ppp2;
{
if ((ppp2 -> f_blocks == 0) && (ppp1 -> f_blocks == 0))
return (0);
else if (ppp2 -> f_blocks == 0)
return (-1);
else if (ppp1 -> f_blocks == 0)
return (1);
if (current_server ->
disk_space_sort_order == 1)
return (((ppp2 -> f_bfree * 100) / ppp2 -> f_blocks) -
((ppp1 -> f_bfree * 100) / ppp1 -> f_blocks));
else
return (((ppp1 -> f_bfree * 100) / ppp1 -> f_blocks) -
((ppp2 -> f_bfree * 100) / ppp2 -> f_blocks));
} /* end of disk_space_percent_free_compare */
/*-------------------------------------------------------------------------
disk_space_itotal_compare(ppp1,ppp2)
--------------------------------------------------------------------------*/
disk_space_itotal_compare (ppp1, ppp2)
register disk_space *ppp1;
register disk_space *ppp2;
{
if (current_server ->
disk_space_sort_order == 1)
return (ppp2 -> f_files - ppp1 -> f_files);
else
return (ppp1 -> f_files - ppp2 -> f_files);
} /* end of disk_space_total_compare */
/*-------------------------------------------------------------------------
disk_space_iused_compare(ppp1,ppp2)
--------------------------------------------------------------------------*/
disk_space_iused_compare (ppp1, ppp2)
register disk_space *ppp1;
register disk_space *ppp2;
{
if (current_server ->
disk_space_sort_order == 1)
return (
(ppp2 -> f_files - ppp2 -> f_ffree) -
(ppp1 -> f_files - ppp1 -> f_ffree));
else
return (
(ppp1 -> f_files - ppp1 -> f_ffree) -
(ppp2 -> f_files - ppp2 -> f_ffree));
} /* end of disk_space_iused_compare */
/*-------------------------------------------------------------------------
disk_space_ifree_compare(ppp1,ppp2)
--------------------------------------------------------------------------*/
disk_space_ifree_compare (ppp1, ppp2)
register disk_space *ppp1;
register disk_space *ppp2;
{
if (current_server ->
disk_space_sort_order == 1)
return (ppp2 -> f_ffree - ppp1 -> f_ffree);
else
return (ppp1 -> f_ffree - ppp2 -> f_ffree);
} /* end of disk_space_ifree_compare */
/*-------------------------------------------------------------------------
disk_space_percent_iused_compare(ppp1,ppp2)
NOTE: The return value MUST be an integer.... Should revisit this...
--------------------------------------------------------------------------*/
disk_space_percent_iused_compare (ppp1, ppp2)
register disk_space *ppp1;
register disk_space *ppp2;
{
if ((ppp2 -> f_files == 0) && (ppp1 -> f_files == 0))
return (0);
else if (ppp2 -> f_files == 0)
return (-1);
else if (ppp1 -> f_files == 0)
return (1);
if (current_server ->
disk_space_sort_order == 1)
return ((((ppp2 -> f_files - ppp2 -> f_ffree) * 100) / ppp2 -> f_files) -
(((ppp1 -> f_files - ppp1 -> f_ffree) * 100) / ppp1 -> f_files));
else
return ((((ppp1 -> f_files - ppp1 -> f_ffree) * 100) / ppp1 -> f_files) -
(((ppp2 -> f_files - ppp2 -> f_ffree) * 100) / ppp2 -> f_files));
} /* end of disk_space_percent_iused_compare */
/*-------------------------------------------------------------------------
disk_space_percent_ifree_compare(ppp1,ppp2)
NOTE: The return value MUST be an integer.... Should revisit this...
--------------------------------------------------------------------------*/
disk_space_percent_ifree_compare (ppp1, ppp2)
register disk_space *ppp1;
register disk_space *ppp2;
{
if ((ppp2 -> f_files == 0) && (ppp1 -> f_files == 0))
return (0);
else if (ppp2 -> f_files == 0)
return (-1);
else if (ppp1 -> f_files == 0)
return (1);
if (current_server ->
disk_space_sort_order == 1)
return (((ppp2 -> f_ffree * 100) / ppp2 -> f_files) -
((ppp1 -> f_ffree * 100) / ppp1 -> f_files));
else
return (((ppp1 -> f_ffree * 100) / ppp1 -> f_files) -
((ppp2 -> f_ffree * 100) / ppp2 -> f_ffree));
} /* end of disk_space_percent_ifree_compare */
/*-------------------------------------------------------------------------
disk_space_mount_compare(ppp1,ppp2)
--------------------------------------------------------------------------*/
disk_space_mount_compare (ppp1, ppp2)
register disk_space *ppp1;
register disk_space *ppp2;
{
if (current_server ->
disk_space_sort_order == 1)
return (strcmp (ppp2 -> dir, ppp1 -> dir));
else
return (strcmp (ppp1 -> dir, ppp2 -> dir));
} /* end of disk_space_mount_compare */
sort_disk_space ()
{
switch (current_server -> disk_space_screen_mode)
{
case 1:
switch (current_server -> disk_space_sort_mode[0])
{
case 0:
(void) qsort ((char *) current_server -> current_disk_space,
(unsigned) current_server -> current_disk_space_entries,
sizeof (disk_space),
disk_space_total_compare);
break;
case 1:
(void) qsort ((char *) current_server -> current_disk_space,
(unsigned) current_server -> current_disk_space_entries,
sizeof (disk_space),
disk_space_used_compare);
break;
case 2:
(void) qsort ((char *) current_server -> current_disk_space,
(unsigned) current_server -> current_disk_space_entries,
sizeof (disk_space),
disk_space_free_compare);
break;
case 3:
(void) qsort ((char *) current_server -> current_disk_space,
(unsigned) current_server -> current_disk_space_entries,
sizeof (disk_space),
disk_space_percent_used_compare);
break;
case 4:
(void) qsort ((char *) current_server -> current_disk_space,
(unsigned) current_server -> current_disk_space_entries,
sizeof (disk_space),
disk_space_percent_free_compare);
break;
case 5:
(void) qsort ((char *) current_server -> current_disk_space,
(unsigned) current_server -> current_disk_space_entries,
sizeof (disk_space),
disk_space_mount_compare);
break;
}
break;
case 2:
switch (current_server -> disk_space_sort_mode[1])
{
case 0:
(void) qsort ((char *) current_server -> current_disk_space,
(unsigned) current_server -> current_disk_space_entries,
sizeof (disk_space),
disk_space_total_compare);
break;
case 1:
(void) qsort ((char *) current_server -> current_disk_space,
(unsigned) current_server -> current_disk_space_entries,
sizeof (disk_space),
disk_space_used_compare);
break;
case 2:
(void) qsort ((char *) current_server -> current_disk_space,
(unsigned) current_server -> current_disk_space_entries,
sizeof (disk_space),
disk_space_free_compare);
break;
case 3:
(void) qsort ((char *) current_server -> current_disk_space,
(unsigned) current_server -> current_disk_space_entries,
sizeof (disk_space),
disk_space_percent_used_compare);
break;
case 4:
(void) qsort ((char *) current_server -> current_disk_space,
(unsigned) current_server -> current_disk_space_entries,
sizeof (disk_space),
disk_space_percent_free_compare);
break;
case 5:
(void) qsort ((char *) current_server -> current_disk_space,
(unsigned) current_server -> current_disk_space_entries,
sizeof (disk_space),
disk_space_mount_compare);
break;
}
break;
case 3:
switch (current_server -> disk_space_sort_mode[2])
{
case 0:
(void) qsort ((char *) current_server -> current_disk_space,
(unsigned) current_server -> current_disk_space_entries,
sizeof (disk_space),
disk_space_itotal_compare);
break;
case 1:
(void) qsort ((char *) current_server -> current_disk_space,
(unsigned) current_server -> current_disk_space_entries,
sizeof (disk_space),
disk_space_iused_compare);
break;
case 2:
(void) qsort ((char *) current_server -> current_disk_space,
(unsigned) current_server -> current_disk_space_entries,
sizeof (disk_space),
disk_space_ifree_compare);
break;
case 3:
(void) qsort ((char *) current_server -> current_disk_space,
(unsigned) current_server -> current_disk_space_entries,
sizeof (disk_space),
disk_space_percent_iused_compare);
break;
case 4:
(void) qsort ((char *) current_server -> current_disk_space,
(unsigned) current_server -> current_disk_space_entries,
sizeof (disk_space),
disk_space_percent_ifree_compare);
break;
case 5:
(void) qsort ((char *) current_server -> current_disk_space,
(unsigned) current_server -> current_disk_space_entries,
sizeof (disk_space),
disk_space_mount_compare);
break;
}
break;
}
}
unsigned long
get_disk_space_pixel (current, bak)
float current, bak;
{
if (current > bak)
return (colorDiskspaceGaining.pixel);
else if (current < bak)
return (colorDiskspaceLosing.pixel);
else
return (colorDiskspaceStable.pixel);
}
/*+-------------------------------------------------------------------------
update_disk_space()
--------------------------------------------------------------------------*/
void
update_disk_space (SP)
struct NetworkXswStruct *SP;
{
Window window = SP ->
SEPERATE_WINDOWS_LIST[BUTTON_disk_space].window;
Display *display = SP ->
SEPERATE_WINDOWS_LIST[BUTTON_disk_space].display;
GC gc = SP -> SEPERATE_WINDOWS_LIST[BUTTON_disk_space].gc;
XWindowAttributes DrawAreaXYWH = SP ->
SEPERATE_WINDOWS_LIST[BUTTON_disk_space].DrawAreaXYWH;
Pixmap pixmap = SP ->
SEPERATE_WINDOWS_LIST[BUTTON_disk_space].pixmap;
register int x, y;
int fheight = FHEIGHT;
unsigned long pixel;
int i;
int w;
int bak_index = -1;
float total_total = 0.0;
float total_used = 0.0;
float total_free = 0.0;
/*
* Should keep track of previous total free across all views, otherwise
* switching views will cause the total to change color, perhaps to the
* WRONG color.....
*
*/
static float total_free_bak = 0.0;
float total_percent_used = 0.0;
float total_percent_free = 0.0;
float p_free_inodes;
float p_used_inodes;
long used_inodes;
float p_free_blocks;
float p_used_blocks;
int temp1;
int temp2;
int drawn_number = 0;
y = diskspace_tly;
x = diskspace_tlx;
XSetForeground (display, gc, background);
XFillRectangle (display, pixmap, gc, x, y, SP -> SEPERATE_WINDOWS_LIST[BUTTON_disk_space].width - x, FHEIGHT * SP -> SEPERATE_WINDOWS_LIST[BUTTON_disk_space].height - 1);
sort_disk_space ();
for (w = 0; w < current_server -> current_disk_space_entries; w++)
{
/*
* If we have a nfs filesystem AND we should NOT show it, then skip this...
*/
if ( (current_server -> current_disk_space[w].nfs_filesystem == 1) &&
(current_server -> show_nfs == 0 ) )
continue;
for (i = 0; i < current_server -> current_disk_space_entries_bak; i++)
{
if (strcmp (current_server -> current_disk_space[w].dir,
current_server -> current_disk_space_bak[i].dir) == 0)
{
bak_index = i;
break;
}
else
bak_index = -1;
}
x = diskspace_tlx;
drawn_number++;
/*
* Clear the enitre line
*/
XSetForeground (display, gc, background);
XFillRectangle (display, pixmap, gc, x, y,
SP -> SEPERATE_WINDOWS_LIST[BUTTON_disk_space].draw_width - x,
FHEIGHT);
if (current_server -> current_disk_space[w].problems == 1)
disp_info_text (window, display, gc, DrawAreaXYWH, x, y,
pixmap, colorNumericAlarm.pixel,
"?");
else
disp_info_text (window, display, gc, DrawAreaXYWH, x, y,
pixmap, colorLabel.pixel,
" ");
x += (FWIDTH);
switch (SP -> disk_space_screen_mode)
{
case 1:
{
float total_mb;
float total_mb_bak;
float free_mb;
float free_mb_bak;
float used_mb;
float used_mb_bak;
/*
* calculate initial data
*/
total_mb =
((float) current_server ->
current_disk_space[w].f_blocks / 2) / 1024;
total_total += total_mb;
free_mb =
((float) current_server ->
current_disk_space[w].f_bfree / 2) / 1024;
total_free += free_mb;
used_mb = total_mb - free_mb;
total_used += used_mb;
if (bak_index != -1)
{
total_mb_bak =
((float) current_server ->
current_disk_space_bak[bak_index].f_blocks / 2)
/ 1024;
free_mb_bak =
((float) current_server ->
current_disk_space_bak[bak_index].f_bfree / 2) / 1024;
used_mb_bak = total_mb_bak - free_mb_bak;
}
pixel = get_disk_space_pixel (free_mb, free_mb_bak);
disp_float (window, display, gc, DrawAreaXYWH, pixmap, x, y,
"%8.2f", colorStaticNumeric.pixel, total_mb);
x += (FWIDTH * 10);
disp_float (window, display, gc, DrawAreaXYWH, pixmap, x, y,
"%8.2f", pixel, used_mb);
x += (FWIDTH * 10);
disp_float (window, display, gc, DrawAreaXYWH, pixmap, x, y,
"%8.2f", pixel, free_mb);
x += (FWIDTH * 10);
if (total_mb != 0)
{
disp_float (window, display, gc, DrawAreaXYWH, pixmap, x, y,
"%8.2f%%", pixel, (float) (used_mb * 100) / total_mb);
}
else
disp_float (window, display, gc, DrawAreaXYWH, pixmap, x, y,
"%8.2f%%", colorNumeric.pixel, 0);
x += (FWIDTH * 10);
if (total_mb != 0)
{
disp_float (window, display, gc, DrawAreaXYWH, pixmap, x, y,
"%8.2f%%", pixel, (float) (free_mb * 100) / total_mb);
}
else
disp_float (window, display, gc, DrawAreaXYWH, pixmap, x, y,
"%8.2f%%", colorNumeric.pixel, 0);
x += (FWIDTH * 10);
disp_info_text (window, display, gc, DrawAreaXYWH, x, y, pixmap,
colorLabel.pixel,
(char *) current_server -> current_disk_space[w].dir);
x += (FWIDTH * 33);
disp_info_text (window, display, gc, DrawAreaXYWH, x, y, pixmap,
colorLabel.pixel,
(char *) current_server -> current_disk_space[w].dev);
}
break;
case 2:
temp1 = current_server -> current_disk_space[w].f_bfree;
temp2 = current_server -> current_disk_space_bak[bak_index].f_bfree;
if (temp1 > temp2)
pixel = colorDiskspaceGaining.pixel;
else if (temp1 < temp2)
pixel = colorDiskspaceLosing.pixel;
else
pixel = colorDiskspaceStable.pixel;
disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y,
"%8ld", colorStaticNumeric.pixel,
current_server -> current_disk_space[w].f_blocks);
total_total += current_server -> current_disk_space[w].f_blocks;
x += (FWIDTH * 10);
disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y,
"%8ld", pixel,
current_server -> current_disk_space[w].f_blocks -
current_server -> current_disk_space[w].f_bfree);
x += (FWIDTH * 10);
total_used += (current_server -> current_disk_space[w].f_blocks -
current_server -> current_disk_space[w].f_bfree);
disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y,
"%8ld", pixel,
current_server -> current_disk_space[w].f_bfree);
x += (FWIDTH * 10);
total_free += current_server -> current_disk_space[w].f_bfree;
if (current_server -> current_disk_space[w].f_blocks != 0)
disp_float (window, display, gc, DrawAreaXYWH, pixmap, x, y,
"%8.2f%%", pixel,
(float) ((current_server -> current_disk_space[w].f_blocks -
current_server -> current_disk_space[w].f_bfree) * 100) /
current_server -> current_disk_space[w].f_blocks);
else
disp_float (window, display, gc, DrawAreaXYWH, pixmap, x, y,
"%8.2f%%", colorNumeric.pixel, 0);
x += (FWIDTH * 10);
if (current_server -> current_disk_space[w].f_blocks != 0)
disp_float (window, display, gc, DrawAreaXYWH, pixmap, x, y,
"%8.2f%%", pixel,
(float) (current_server -> current_disk_space[w].f_bfree * 100) /
current_server -> current_disk_space[w].f_blocks);
else
disp_float (window, display, gc, DrawAreaXYWH, pixmap, x, y,
"%8.2f%%", colorNumeric.pixel, 0);
x += (FWIDTH * 10);
disp_info_text (window, display, gc, DrawAreaXYWH, x, y, pixmap,
colorLabel.pixel,
(char *) current_server -> current_disk_space[w].dir);
x += (FWIDTH * 33);
disp_info_text (window, display, gc, DrawAreaXYWH, x, y, pixmap,
colorLabel.pixel,
(char *) current_server -> current_disk_space[w].dev);
break;
case 3:
temp1 = current_server -> current_disk_space[w].f_ffree;
temp2 = current_server -> current_disk_space_bak[bak_index].f_ffree;
if (temp1 > temp2)
pixel = colorDiskspaceGaining.pixel;
else if (temp1 < temp2)
pixel = colorDiskspaceLosing.pixel;
else
pixel = colorDiskspaceStable.pixel;
used_inodes = current_server -> current_disk_space[w].f_files -
current_server -> current_disk_space[w].f_ffree;
if (current_server -> current_disk_space[w].f_files != 0)
p_free_inodes =
((float) current_server ->
current_disk_space[w].f_ffree * 100) /
(float) current_server -> current_disk_space[w].f_files;
if (current_server -> current_disk_space[w].f_files != 0)
p_used_inodes =
((float) used_inodes * 100) /
(float) current_server -> current_disk_space[w].f_files;
disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y,
"%8ld", colorStaticNumeric.pixel,
current_server -> current_disk_space[w].f_files);
x += (FWIDTH * 10);
total_total += current_server -> current_disk_space[w].f_files;
disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y,
"%8ld", pixel, used_inodes);
x += (FWIDTH * 10);
total_used += used_inodes;
disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y,
"%8ld", pixel,
current_server -> current_disk_space[w].f_ffree);
x += (FWIDTH * 10);
total_free += current_server -> current_disk_space[w].f_ffree;
if (current_server -> current_disk_space[w].f_files != 0)
{
disp_float (window, display, gc, DrawAreaXYWH, pixmap, x, y,
"%8.2f%%", pixel, p_used_inodes);
}
else
disp_float (window, display, gc, DrawAreaXYWH, pixmap, x, y,
"%8.2f%%", colorNumeric.pixel, 0);
x += (FWIDTH * 10);
if (current_server -> current_disk_space[w].f_files != 0)
{
disp_float (window, display, gc, DrawAreaXYWH, pixmap, x, y,
"%8.2f%%", pixel, p_free_inodes);
}
else
disp_float (window, display, gc, DrawAreaXYWH, pixmap, x, y,
"%8.2f%%", colorNumeric.pixel, 0);
x += (FWIDTH * 10);
disp_info_text (window, display, gc, DrawAreaXYWH, x, y, pixmap,
colorLabel.pixel,
(char *) current_server -> current_disk_space[w].dir);
x += (FWIDTH * 33);
disp_info_text (window, display, gc, DrawAreaXYWH, x, y, pixmap,
colorLabel.pixel,
(char *) current_server -> current_disk_space[w].dev);
break;
}
/*
* Jump to next line......
*/
y += +fheight;
}
x = diskspace_tlx;
/*
* Clear everything below now....
*/
XSetForeground (display, gc, background);
XFillRectangle (display, pixmap, gc,
0, drawn_number * fheight,
SP -> SEPERATE_WINDOWS_LIST[BUTTON_disk_space].draw_width,
SP -> SEPERATE_WINDOWS_LIST[BUTTON_disk_space].draw_height);
if (current_server -> show_disk_totals == 1)
{
pixel = get_disk_space_pixel (total_free, total_free_bak);
XSetForeground (display, gc, colorDiskspaceStable.pixel);
XDrawLine (display, pixmap, gc,
x, y,FWIDTH * 57,
/*
DisplayWidth (display, screen),
*/
y);
XDrawLine (display, pixmap, gc,
x, y + (fheight /2),FWIDTH * 57,
/*
DisplayWidth (display, screen),
*/
y + (fheight /2));
/*
disp_info_text (window, display, gc, DrawAreaXYWH, x, y,
pixmap, colorNumeric.pixel,
" ======== ========= ========= ========== ========= ==========");
*/
y += +fheight;
x += (FWIDTH);
switch (SP -> disk_space_screen_mode)
{
case 1:
disp_float (window, display, gc, DrawAreaXYWH, pixmap, x, y,
"%8.2f", colorStaticNumeric.pixel, total_total);
x += (FWIDTH * 10);
disp_float (window, display, gc, DrawAreaXYWH, pixmap, x, y,
"%8.2f", pixel, total_used);
x += (FWIDTH * 10);
disp_float (window, display, gc, DrawAreaXYWH, pixmap, x, y,
"%8.2f", pixel, total_free);
x += (FWIDTH * 10);
total_percent_used =
(float) (total_used * 100) / total_total;
disp_float (window, display, gc, DrawAreaXYWH, pixmap, x, y,
"%8.2f%%", pixel, (float) total_percent_used);
x += (FWIDTH * 10);
total_percent_free =
(float) (total_free * 100) / total_total;
disp_float (window, display, gc, DrawAreaXYWH, pixmap, x, y,
"%8.2f%%", pixel, (float) total_percent_free);
x += (FWIDTH * 10);
break;
case 2:
case 3:
disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y,
"%8ld", colorStaticNumeric.pixel,
(int) total_total);
x += (FWIDTH * 10);
disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y,
"%8ld", pixel,
(int) total_used);
x += (FWIDTH * 10);
disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y,
"%8ld", pixel,
(int) total_free);
x += (FWIDTH * 10);
total_percent_used =
(float) (total_used * 100) / total_total;
disp_float (window, display, gc, DrawAreaXYWH, pixmap, x, y,
"%8.2f%%", pixel, (float) total_percent_used);
x += (FWIDTH * 10);
total_percent_free =
(float) (total_free * 100) / total_total;
disp_float (window, display, gc, DrawAreaXYWH, pixmap, x, y,
"%8.2f%%", pixel, (float) total_percent_free);
x += (FWIDTH * 10);
break;
}
disp_info_text (window, display, gc, DrawAreaXYWH, x, y, pixmap,
colorLabel.pixel,
(char *) "TOTAL");
x += (FWIDTH * 33);
}
total_free_bak = total_free;
} /* end of update_disk_space */
/* end of diskspace.c */